#!/bin/sh

if [ "${CELL_PATH}" = "" ]; then
    CELL_PATH=`dirname "$0"`
fi

if [ "${CELL_ARCH}" = "" ]; then
    CELL_ARCH=`uname -m`
fi

cd "$CELL_PATH"

if [ ! -f cell.desktop ]; then
    echo "Little Cells: creating desktop shortcut."
    echo "[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=\"`pwd`/cell\"
Name=Little Cells
Icon=`pwd`/cell.png" > cell.desktop
fi

if [ "${CELL_ARCH}" = "x86_64" ]; then
    echo "Little Cells: Using amd64 version."
    cd "$CELL_PATH/amd64"
else
    echo "Little Cells: Using x86 version."
    cd "$CELL_PATH/x86"
fi
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH exec ./cell "$@"
